<?php

/**
 * Criado em : 18/10/2012, 16:35:45
 * Autor     : info
 * @author Lemoel Marques Vieira <lemoel@gmail.com>
 */
class C_Tpservicos extends Controller {
    
    public function index() {
        
        $servicos = new M_TpServico();
        
        $arrayServicos = $servicos->retornaServico();
        
        foreach ($arrayServicos as $value) {

            $dados['servicos'] .= "<tr>";
            $dados['servicos'] .= "<td width='100'>".$value['CD_TP_SV']."</td>";
            $dados['servicos'] .= "<td>".$value['TP_SERVICO']."</td>";
            $dados['servicos'] .= "<td width='80'>".$value['AREA']."</td>";
            $dados['servicos'] .= "<td width='60'><a href='#' onclick = 'novoTpServico()'>Novo</a></td>";
            $dados['servicos'] .= "<td width='60'><a href='#' onclick = 'editarTpServico(". $value['CD_TP_SV'].")'>Editar</a></td>";
            $dados['servicos'] .= "<td width='60'>Excluir</td>";
            $dados['servicos'] .= "</tr>";
            
        }

        $this->view('v_servicos',$dados);
        
    }
    
    
    public function formEditarTpServico() {
        //Array ( [idTpServico] => 15 ) 
        
        $tpServico = new M_TpServico();
        
        $where = 'CD_TP_SV = ' . $_POST['idTpServico'];
        
        $arrayTpServico = $tpServico->retornaServico(null,$where);
        
        $this->view('v_formeditartpservicos',$arrayTpServico[0]);
    }
    
}

?>
